package mn.idax.exchange.otc;

import mn.idax.exchange.otc.interceptor.RequestReplacedFilter;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.ImportResource;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@MapperScan(basePackages = {"mn.idax.exchange.otc.mapper*"})
@ImportResource({"classpath:dubbo-provider.xml"})
@SpringBootApplication(scanBasePackages = {"mn.idax"})
@EnableTransactionManagement
@EnableAspectJAutoProxy(exposeProxy = true)
public class OtcApplication {

    public static void main(String[] args) {
        SpringApplication.run(OtcApplication.class, args);
    }

    @SuppressWarnings({ "rawtypes", "unchecked" })

    @Bean
    public FilterRegistrationBean httpServletRequestReplacedRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new RequestReplacedFilter());
        registration.addUrlPatterns("/*");
        registration.addInitParameter("paramName", "paramValue");
        registration.setName("httpServletRequestReplacedFilter");
        registration.setOrder(1);
        return registration;
    }
}
